
$(function(){
    fetch('http://chst.vip:1234/api/getindexmenu').then(response=>{
        return response.json()
    }).then(value=>{
        azyxhr = value.result
        let str = ``
        azyxhr.forEach(item => {
            let src = item.img.match(/[0-9a-zA-Z_/.]+/g)[2];
            str+= `<div htmlname=${item.titlehref}>
                        <img src=http://chst.vip:8081/for-stu/wfzh/${src}></img>
                        <p>${item.name}</p>
                   </div>`
        })
        $('#item').html(str)
        $('#item div:eq(8)').attr('class','down').slideUp(0)
        $('#item div:eq(9)').attr('class','down').slideUp(0)
        $('#item div:eq(10)').attr('class','down').slideUp(0)
        $('#item div:eq(11)').attr('class','down').slideUp(0)
        $('#item div:eq(7)').click(function(){
            $('#item .down').slideToggle(500)
        })
    })
    $('#item').on('click','div',function(){
        if($(this).attr('htmlname')=="#"){
            return
        }else{
            location.href =`http://127.0.0.1:5500/domo/千锋商城项目/html/`+$(this).attr('htmlname');
        }
    })


    fetch('http://chst.vip:1234/api/getmoneyctrl').then(response1=>{
        return response1.json()
    }).then(val=>{
        lisArr = val.result
        let kongStr = ''
        lisArr.forEach(function(item){
           
            kongStr+=`<li productId=${item.productId}>
                        <div class="liLeft">
                            <img src='${item.productImg2.match(/[0-9a-zA-Z./:]+/g)[8]}' alt="">
                        </div>
                        <div class="liRight">
                            <h4>
                                ${item.productName}
                                <span>${item.productPinkage}</span>
                            </h4>
                            <p>
                                <span>${item.productFrom}|${item.productTime}</span>
                                <span>
                                    <i class="iconfont icon-pinglun"></i>
                                    ${item.productComCount}
                                </span>
                            </p>
                        </div>
                    </li>
            `
        })
        $('main .products').html(kongStr)
        $('main .products li').click(function(){
            location.href = `http://127.0.0.1:5500/domo/千锋商城项目/html/moneyctrlin.html?productId=${$(this).attr('productId')}`
        })
    })

    
   toTop()
})



